
var hasPathSum = function (root, targetSum) {
  const lujinSum = (root, sum) => {
    if (!root) return false;
    if (!root.left && !root.right) {
      return sum + root.val === targetSum;
    }
    sum += root.val;
    return lujinSum(root.left,sum) || lujinSum(root.right,sum)
  }
  return lujinSum(root, 0)
};
// 1 2 3 4
//1 2 4 3
// 1 3 2 4